/*
 * @Author: 李天惊 uf_lee@163.com
 * @Date: 2025-04-12 22:01:48
 * @LastEditors: 李天惊 uf_lee@163.com
 * @LastEditTime: 2025-04-13 10:11:42
 * @FilePath: \leemvvm\lee-mvvm\src\playground\App.ts
 * Copyright (c) 2025 by ${git_name_email}, All Rights Reserved.
 */
import { createApp } from "../runtime";
import { reactive } from "../core/reactivity/reactive";
import { effect } from "../core/reactivity/effect";
import template from "./App.html?raw";
import Counter from "./Counter";

const App = {
  components: {
    Counter,
  },
  setup() {
    // 返回响应式数据
    return {};
  },
  template, // 用模板代替render渲染函数
};

// 挂载应用
const el = document.getElementById("app");
if (el) {
  // 创建应用并挂载
  const app = createApp(App);
  // 挂载应用
  app.mount(el);
} else {
  // 抛出异常
  throw new Error("挂载元素 #app 不存在");
}
